package com.gitee.wsl.compose.ui.richtext.content

import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.style.ResolvedTextDirection

/**
 * A Callback to render the leading margin.
 */
fun interface ParagraphContentDrawer {
    fun onDraw(
        drawScope: DrawScope,
        layoutInfo: ParagraphLayoutInfo
    )
}


/**
 * The data class which holds paragraph area and text layout result.
 */
@Suppress("unused")
class ParagraphLayoutInfo(
    val result: TextLayoutResult,
    val startLine: Int,
    val endLine: Int,
    val x: Float,
    val top: Float,
    val bottom: Float,
    val direction: ResolvedTextDirection
) {

    val height: Float
        get() = bottom - top

    internal val dirSign: Int
        get() = if (direction == ResolvedTextDirection.Ltr) {
            +1
        } else {
            -1
        }
}





